#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include <assert.h>
typedef struct student
{
	int id;
	char name[10];
	char sex;
	int old;
	struct student* next;
}SLnode;
void SLpushFront(SLnode** pphead)
{
	SLnode* p = (SLnode*)malloc(sizeof(SLnode));
	*pphead = p;
	scanf("%d", &p->id);
	scanf("%s", p->name);
	scanf(" %c", &p->sex);
	scanf("%d", &p->old);
	p->next = NULL;
}
void SLpushBack(SLnode* plist)
{
	assert(plist);
	SLnode* p = (SLnode*)malloc(sizeof(SLnode));
	while (plist->next)
	{
		plist = plist->next;
    }
	plist->next = p;
	scanf("%d", &p->id);
	scanf("%s", p->name);
	scanf(" %c", &p->sex);
	scanf("%d", &p->old);
	p->next = NULL;
}
void print(SLnode* plist)
{
	while (plist)
	{
		printf("%d", plist->id);
		printf(" %s", plist->name);
		printf(" %c", plist->sex);
		printf(" %d", plist->old);
		printf("\n");
		plist = plist->next;
	}
}
int main()
{
	SLnode *plist = NULL;
	SLpushFront(&plist);
	SLpushBack(plist);
	SLpushBack(plist);
	SLpushBack(plist);
	SLpushBack(plist);
	print(plist);

	return 0;
}